<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加任务攻略</title>
    <style>
        .two-part-label{
            width: 200px !important;
        }
    </style>
</head>
<body>
<form class="layui-form" lay-filter="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label">季节</label>
                <div class="layui-input-block">
                    <div class="xmSelect"
                         data-name="season"
                         data-sourceType="route"
                         data-source="/admin.sky.season/season"
                         data-textField="sub_category"
                         data-valueField="sub_category"
                         data-radio="true"
                    ></div>
                </div>
            </div>

            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">标题</label>
                <div class="layui-input-block">
                    <input type="text" name="navBarTitle" lay-verify="required" autocomplete="off" placeholder="请输入标题名称" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">索引标题</label>
                <div class="layui-input-block">
                    <input type="text" name="taskIndexTitle" lay-verify="required" autocomplete="off" placeholder="请输入索引标题" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">关于</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入季节任务描述" name="description" id="LAY_demo" lay-verify="content"></textarea>
                </div>
            </div>

            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务1索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index1" lay-verify="required" autocomplete="off" placeholder="请输入任务1索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务1标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title1" lay-verify="required" autocomplete="off" placeholder="请输入任务1标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务1</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content1"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务2索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index2"  autocomplete="off" placeholder="请输入任务2索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务2标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title2" autocomplete="off" placeholder="请输入任务2标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务2</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content2"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务3索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index3" autocomplete="off" placeholder="请输入任务3索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务3标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title3" autocomplete="off" placeholder="请输入任务3标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务3</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content3"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务4索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index4" autocomplete="off" placeholder="请输入任务4索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务4标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title4" autocomplete="off" placeholder="请输入任务4标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务4</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content4"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务5索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index5" autocomplete="off" placeholder="请输入任务5索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务5标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title5" autocomplete="off" placeholder="请输入任务5标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务5</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content5"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务6索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index6" autocomplete="off" placeholder="请输入任务6索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务6标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title6" autocomplete="off" placeholder="请输入任务6标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务6</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content6"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>



            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务7索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index7" autocomplete="off" placeholder="请输入任务7索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务7标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title7" autocomplete="off" placeholder="请输入任务7标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务7</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content7"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>




            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务8索引</label>
                <div class="layui-input-block">
                    <input type="text" name="index8" autocomplete="off" placeholder="请输入任务8索引" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" style="width: 40%">
                <label class="layui-form-label">任务8标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title8" autocomplete="off" placeholder="请输入任务8标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任务8</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="content8"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-radio="false"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>



        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="add">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script>
    if(localStorage.getItem("staticDomain")){
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }else{
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }
</script>
<script>
    layui.use(['laytp','xmSelect','form','layedit'], function () {
        let $ = layui.jquery;
        let layedit = layui.layedit;
        layedit.set({
            uploadImage:{
                url:"/admin.common/editUpload"
                ,type:''//默认post
            },
            uploadVideo:{
                url:"/admin.common/editUpload"
                ,type:''//默认post
            }
        })
        var index = layedit.build('LAY_demo', {
            tool: ['strong', 'italic', 'underline', 'del', '|', 'left', 'center', 'right','|','image','video'],
            height: 500,
        });

        layui.form.verify({
            content: function(value) {
                return layedit.sync(index);
            },
        });

        layui.form.on('submit(add)', function(data){
            var btnAnim = layui.button.load({elem:$(this)});
            facade.ajax({
                route:'/admin.sky.strategy/add',
                data : data.field
            }).done(function(res){
                if(res.code === 0){
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.funController.tableRender();
                    parent.parent.renderMenu();//重新渲染菜单
                }
                btnAnim.stop();
            }).fail(function(){
                btnAnim.stop();
            });
            return false;
        });
    });
</script>
</body>
</html>